﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Internal.Master" Inherits="BPM.Web.ViewPage" %>

<%@ Import Namespace="Webdiyer.WebControls.Mvc" %>
<%@ Import Namespace="BPM" %>
<%@ Import Namespace="BPM.Entity" %>
<asp:Content ID="c1" ContentPlaceHolderID="TitleContent" runat="server">
	进货单列表
</asp:Content>
<asp:Content ID="c3" ContentPlaceHolderID="ScriptStyleContent" runat="server">
</asp:Content>
<asp:Content ID="c2" ContentPlaceHolderID="MainContent" runat="server">
	<%
		var list = this.ViewData["List"] as PagedList<PurchaseOrder>;
		var ad = AD.Singleton.PurchaseOrder;
		if (list.Count == 0)
		{
	%>
	<div>
		暂时没有数据
	</div>
	<%
}
		else
		{
	%>
	<table class="altTable" cellpadding="0" cellspacing="0">
		<thead>
			<tr>
				<td>
					进货单条码
				</td>
				<td>
					提交人
				</td>
				<td>
					提交时间
				</td>
				<td>
					物料总数
				</td>
				<td>
					已到货数
				</td>
				<td>
					状态
				</td>
				<td>
					&nbsp;
				</td>
			</tr>
		</thead>
		<tbody>
			<%
				foreach (var item in list)
				{
					var total = item.GetTotalAmout();
					var inDeliveried = item.GetInDeliveryAmount();
			%>
			<tr>
				<td>
					<%= item.Barcode.Number %>
				</td>
				<td>
					<%= item.Creator.RealName %>
				</td>
				<td>
					<%= item.CreatedTime %>
				</td>
				<td>
					<%= total %>
				</td>
				<td>
					<%= inDeliveried %>
				</td>
				<td>
					<%= total == inDeliveried ? "已完成" : "等待进货中..." %>
				</td>
				<td>
					<%: Html.ActionLink("查看", ad.PurchaseOrderByStorager, new { item.Id })%>
				</td>
			</tr>
			<%
				} 
			%>
		</tbody>
	</table>
	<%
}
	%>
</asp:Content>
